﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace com.kmer.interfaces {

	public interface ITaskFactory : IFactory {
		/// <summary>
		/// 注册任务（会自动启动）
		/// </summary>
		/// <param name="title"></param>
		/// <param name="interval"></param>
		/// <param name="handler"></param>
		/// <returns></returns>
		bool Register(string title, int interval, EventHandler handler);

		/// <summary>
		/// 停止
		/// </summary>
		/// <param name="title"></param>
		void Stop(string title);

		/// <summary>
		/// 启动，如果已经启动则无视
		/// </summary>
		/// <param name="title"></param>
		/// <returns></returns>
		bool Start(string title);
	}

	public interface ITask{
		EventHandler TaskHandler { get; }
		string Name { get; }
		int Interval { get; }
	}
}
